home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / winsock / ircii2-6.zip / SRC\IRCII-2.6\SOURCE\MATCH.C < prev    next >
C/C++ Source or Header  |  1994-12-28  |  396b  |  27 lines

  1. int    match(char *string, char *pattern)
  2. {
  3.     char *string2;
  4.  
  5.     while (*string && *pattern && *pattern!='*')
  6.     {
  7.         if (*pattern=='?' || mkupper(*pattern)==mkupper(*string))
  8.             pattern++, string++;
  9.         else
  10.             break;
  11.     }
  12.     if (*pattern=='*')
  13.     {
  14.         pattern++;
  15.         while (*string)
  16.         {
  17.             if (match(string, pattern))
  18.                 return 1;
  19.             else
  20.                 string++;
  21.         }
  22.     }
  23.     if (!*string && !*pattern)
  24.         return 1;
  25.     return 0;
  26. }
  27.